package cate.game.play.buff.h;

import cate.game.play.buff.BuffHandler;
import cate.game.play.config.PlayCfgArgs;
import cate.game.play.proce.action.ctx.ActionCtx;

/**
 * 攻击提高3%，伤害加深提高1.5%，最多叠加9层，叠加9层后获得【归元】。不可驱散，持续到战斗结束。
 */
public class 聚气BH extends BuffHandler {

	private int 层数;

	private int 归元buff;

	//层数=9&归元buff=？？
	@Override
	public void parse(String code) {
		PlayCfgArgs args = new PlayCfgArgs(code);
		层数 = args.getInt("层数", 0);
		归元buff = args.getInt("归元buff", 0);
	}

	@Override
	public void onAdd(ActionCtx action) {
		int num = buff.owner.buff.countBuffByTid(buff.tid);
		if (num >= 层数) {
			buff.owner.buff.removeBuffByTid(action, buff.tid);
			buff.owner.buff.tryAddByTid(action, 归元buff);
		}
	}
}
